package edu.washington.cs.workflow.analysis;

import com.ibm.wala.ipa.callgraph.CGNode;

import edu.washington.cs.workflow.util.Utils;

public class GUIObjectInstance {

	public final CGNode node;
	public final String instruction;
	
	public GUIObjectInstance(CGNode node, String instruction) {
		Utils.checkNotNull(node);
		Utils.checkNotNull(instruction);
		this.node = node;
		this.instruction = instruction;
	}
	
	@Override
	public int hashCode() {
		return this.node.hashCode() + 17*this.instruction.hashCode();
	}
	
	@Override
	public String toString() {
		return this.instruction + " AT " + node.toString(); 
	}
	
	@Override
	public boolean equals(Object o) {
		if(!(o instanceof GUIObjectInstance)) {
			return false;
		}
		GUIObjectInstance that = (GUIObjectInstance)o;
		return this.node.equals(that.node)
		    && this.instruction.equals(that.instruction);
	}
}